package mmpathgen.controlflowanalysis;

import java.util.Iterator;

import soot.SootClass;
import soot.SootMethod;

public class MethodFoundChecker {
	
	public final static int DANGLING = 0;
	public final static int HIERARCHY = 1;
	public final static int SIGNATURES = 2;
	public final static int BODIES = 3;
	private int resolvingLevel = DANGLING;

	public static boolean checkMethodFound(String className,
			String methodName, SootClass c) {
		c.checkLevel(SIGNATURES);
		boolean found = false;
		Iterator<SootMethod> methodIt = c.methodIterator();
	
		while (methodIt.hasNext()) {
			SootMethod method = methodIt.next();
	
			if (method.getName().equals(methodName)) {
				if (found) {
					System.out.println("ambiguous method: " + className + "."
							+ methodName);
					return true;
				} else {
					found = false;
				}
			}
		}
		return found;
	}

}
